#
# Makefile for CS181 Markov Decision Processes and Reinforcement Learning
# Do not modify unless you add more source files.
#
# Please note that we use the g++ compiler to take 
# advantage of some C++ features such as streams.
# Feel free to use any C++ features you wish.

SUBMIT   = /usr/local/bin/submit
SOURCES  = throw.c darts.c
HEADERS  = darts.h
OBJECTS  = $(SOURCES:.c=.o)
LIBS     = -lm
RESULTS  = default mdp modelfree modelbased

CC = gcc
CFLAGS = -g -O -Wall -ansi -pedantic -std=c99
RM = rm -f

.SUFFIXES:
.SUFFIXES: .c .o

default: $(OBJECTS) solution.o
	$(CC) -o $@ $(LIBS) $(OBJECTS) solution.o

mdp: $(OBJECTS) mdp.o
	$(CC) -o $@ $(LIBS) $(OBJECTS) mdp.o

modelfree: $(OBJECTS) modelfree.o
	$(CC) -o $@ $(LIBS) $(OBJECTS) modelfree.o

modelbased: $(OBJECTS) modelbased.o
	$(CC) -o $@ $(LIBS) $(OBJECTS) modelbased.o

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

clean:
	$(RM) $(RESULTS) *.o *.core core *~

submit: $(RESULTS)
	$(RM) $(RESULTS) *.o *.core core *~
	$(SUBMIT) cs181 1 `pwd`

throw.o: throw.c darts.h
darts.o: darts.c darts.h
solution.o: solution.c darts.h
mdp.o: mdp.c darts.h
modelfree.o: modelfree.c darts.h
modelbased.o: modelbased.c darts.h
